#include <iostream>
using namespace std;

int main()
{
  // Prompt the user to enter a string
  cout << "Enter the first 9-digit of an ISBN number as a string: ";
  char number[10]; // hold 9 characters with a null terminator
  cin >> number;

  // Calculate checksum
  int sum = 0;
  for (int i = 9; i >= 1; i--)
  {
    sum += (number[i - 1] - '0') * i;
  }

  int checksum = sum % 11;

  cout << "The ISBN number is ";
  cout << number;
  if (checksum == 10)
    cout << "X";
  else
    cout << checksum;

  return 0;
}
